package com.lagou.edu.ad.controller;

import com.lagou.edu.dto.PromotionSpaceDTO;
import com.lagou.edu.remote.AdRemoteService;
import com.lagou.edu.response.ResponseDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/ad")
public class AdController {

    @Autowired
    private AdRemoteService adRemoteService;

    @GetMapping("/space/getAllSpaces")
    public ResponseDTO getAllSpaces() throws Exception {
        List<PromotionSpaceDTO> spacesDto = adRemoteService.getAllSpaces();
        return ResponseDTO.success(spacesDto);
    }
}
